package org.csu.sei.entity.DTO;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.csu.sei.entity.News;

import java.time.LocalDateTime;

@Data
public class NewsIsExistDTO {
    private Long id;
    private String catName;
    private String title;
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    public NewsIsExistDTO(News news,String catName){
        this.id=news.getId();
        this.catName=catName;
        this.title=news.getTitle();
        this.updateTime=news.getUpdateTime();
    }

    public static NewsIsExistDTO returnNewsIsExistDTO(News news,String catName){
        return new NewsIsExistDTO(news,catName);
    }

}
